package com.phuc.game.tankshooter.engine;

import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

import android.content.Context;

/**
 * Class store texture image for sprite
 * @author ChungNT6
 *
 */
public class TextureCommon {

	// face
	private BitmapTextureAtlas tt_face;

	// animate sprite
	private TiledTextureRegion tr_spr_animate;
	
	public TextureCommon(Context context,
			int pWidth, int pHeight, String assetImg, 
			int pTexturePositionX, int pTexturePositionY,
			int pTileColumns, int pTileRows) {
		tt_face = new BitmapTextureAtlas(pWidth, pHeight, TextureOptions.BILINEAR_PREMULTIPLYALPHA); 
		// animate sprite
		tr_spr_animate = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
				tt_face, context, assetImg, pTexturePositionX, pTexturePositionX,
				pTileColumns, pTileRows);	
	}
	
	public Texture getFaceTexture() {
		return tt_face;
	}
	
	public TiledTextureRegion getFaceTiledTextureRegion() {
		return tr_spr_animate.deepCopy();
	}
}
